import { useState } from "react";

export default function AddTodo({ onAddTodo }) {
  const [title, setTitile] = useState("");
  return (
    <div>
      <input
        placeholder="Add todo"
        value={title}
        onInput={(e) => setTitile(e.target.value)}
      ></input>
      <button
        onClick={() => {
          setTitile("");
          onAddTodo(title);
        }}
      >
        Add
      </button>
    </div>
  );
}
